<%@ page language="java" pageEncoding="UTF-8" import="com.king.cms.db.*,com.king.cms.common.*,java.util.*"%> 

<%   
	String pageFunc = "信息发布系统";		//功能描述 
	String path = request.getContextPath();	
	String meetingId = request.getParameter("meetingId");
	String styleText = "align=\"center\" style=\"margin-left:40%;\""; //文本距离右边框的百分比
	String styleLogo = "align=\"center\" style=\"margin-left:40%\""; //logo图片距离右边框的百分比
	
	
	 
	 
%>
 

<%
	Integer sysElemId = new Integer("14");
	String dotype = "add";
	String hytzPort1 = "0";
	String hytzPort2 = "0";
	String hytzPort3 = "0";
	String hytzHymcz = "";
	String hytzHymce = "";
	if(request.getParameter("hytzPort1")!=null)hytzPort1 = request.getParameter("hytzPort1");
	if(request.getParameter("hytzPort2")!=null)hytzPort2 = request.getParameter("hytzPort2");
	if(request.getParameter("hytzPort3")!=null)hytzPort3 = request.getParameter("hytzPort3");
	if(request.getParameter("hytzHymcz")!=null)hytzHymcz = request.getParameter("hytzHymcz");
	if(request.getParameter("hytzHymce")!=null)hytzHymce = request.getParameter("hytzHymce");

	String listtime = "";
	String listtimee = "";
	String listdate = "";
	String listdatee = "";
	String dayofweek = "";
	String dayofweeke = "";
	String temp6 = "";
	String temp7 = "";
	//String day = "";

	if(request.getAttribute("hytzKssj")!=null && request.getAttribute("hytzJssj")!=null)
	{
		String temp1 = (String)request.getAttribute("hytzKssj");
		String temp2 = (String)request.getAttribute("hytzJssj");
		String temp3 = temp1.substring(11,13);
		String temp4 = temp2.substring(11,13);
		String temp8 = temp1.substring(14,16);
		String temp9 = temp2.substring(14,16);

		//String temp8 = temp1.substring(14,16);
		//String temp9 = temp2.substring(14,16);

		int temp5 = new Integer(temp1.substring(5,7)).intValue();
		//System.out.println(temp3);
        if (new Integer(temp8).intValue()<10)
			 temp8 = "0"+ (new Integer(temp8).intValue());
		  else 
			 temp8 = temp8;
        if (new Integer(temp9).intValue()<10)
			 temp9 = "0"+ (new Integer(temp9).intValue());
		else 
			temp9 = temp9;

		if(new Integer(temp3).intValue()<10)
			temp6 = "上午" + "0" + new Integer(temp3).intValue()+":"+ temp8 + " -- ";
		else if(new Integer(temp3).intValue()<12)
			temp6 = "上午" + new Integer(temp3).intValue()+":"+ temp8 + " -- ";
		else if(new Integer(temp3).intValue()==12)
			temp6 = "中午" + "" +(new Integer(temp3).intValue())+":"+ temp8 + " -- ";
		else if(new Integer(temp3).intValue()<18)
			temp6 = "下午" + "0" + (new Integer(temp3).intValue()-12)+":"+ temp8 + " -- ";
		else if(new Integer(temp3).intValue()<22)
		    temp6 = "晚上" + "0" + (new Integer(temp3).intValue()-12)+":"+ temp8 + " -- ";
		else	
		    temp6 = "晚上" + (new Integer(temp3).intValue()-12)+":"+ temp8 + " -- ";
		
		if(new Integer(temp4).intValue()<10)
			temp7 = "上午" + "0" + (new Integer(temp4).intValue())+":"+ temp9;
		else if(new Integer(temp4).intValue()<12)
			temp7 = "上午" + (new Integer(temp4).intValue())+":"+ temp9;
		else if(new Integer(temp4).intValue()==12)
			temp7 = "中午" + "" + (new Integer(temp4).intValue())+":"+temp9;
		else if(new Integer(temp4).intValue()<18)
			temp7 = "下午" + "0" + (new Integer(temp4).intValue()-12)+":"+temp9;
		else if(new Integer(temp4).intValue()<22)
			temp7 = "晚上" + "0" + (new Integer(temp4).intValue()-12)+":"+temp9;
		else
			temp7 = "晚上" + (new Integer(temp4).intValue()-12)+":"+temp9;
		
		listtime = temp6 + temp7;
		//listtimee += temp1.substring(11,16);

		if(new Integer(temp3).intValue()<10)
			temp6 = "0" + new Integer(temp3).intValue()+":"+ temp8 + "am" + " -- ";
		else if(new Integer(temp3).intValue()<12)
			temp6 = new Integer(temp3).intValue()+":"+ temp8 + "am" + " -- ";
		else if(new Integer(temp3).intValue()==12)
			temp6 =  "" +(new Integer(temp3).intValue())+":"+ temp8 + "am" +" -- ";
		else if(new Integer(temp3).intValue()<18)
			temp6 = "0" + (new Integer(temp3).intValue()-12)+":"+ temp8 + "pm" + " -- ";
		else if(new Integer(temp3).intValue()<22)
		    temp6 = "0" + (new Integer(temp3).intValue())+":"+ temp8 +"pm" +  " -- ";
		else	
		    temp6 =  (new Integer(temp3).intValue()-12)+":"+ temp8 +"pm" + " -- ";
		
		if(new Integer(temp4).intValue()<10)
			temp7 = "0" + (new Integer(temp4).intValue())+":"+ temp9+"am" ;
		else if(new Integer(temp4).intValue()<12)
			temp7 = (new Integer(temp4).intValue())+":"+ temp9+"am"  ;
		else if(new Integer(temp4).intValue()==12)
			temp7 = "" + (new Integer(temp4).intValue())+":"+temp9+"am" ;
		else if(new Integer(temp4).intValue()<18)
			temp7 = "0" + (new Integer(temp4).intValue()-12)+":"+temp9+"pm" ;
		else if(new Integer(temp4).intValue()<22)
			temp7 = "0" + (new Integer(temp4).intValue()-12)+":"+temp9+"pm"  ;
		else
			temp7 =  (new Integer(temp4).intValue()-12)+":"+temp9+"pm" ;
		listtimee = temp6 + temp7;

		listdate = temp1.substring(0,4) + "年" + new Integer(temp1.substring(5,7)).toString() + "月" + new Integer(temp1.substring(8,10)) + "日" ;  
		switch (temp5)
		{
			case 1:listdatee+="January";break;
			case 2:listdatee+="February";break;
			case 3:listdatee+="March";break;
			case 4:listdatee+="April";break;
			case 5:listdatee+="May";break;
			case 6:listdatee+="June";break;
			case 7:listdatee+="July";break;
			case 8:listdatee+="August";break;
			case 9:listdatee+="September";break;
			case 10:listdatee+="October";break;
			case 11:listdatee+="November";break;
			case 12:listdatee+="December";break;
		}
		listdatee = new Integer(temp1.substring(8,10))+ "  "+ listdatee + "  " +temp1.substring(0,4);

		//java.util.Calendar cal = java.util.Calendar.getInstance();
		//cal.clear(); cal.set(Integer.parseInt(temp1.substring(0,4)), Integer.parseInt(temp1.substring(5,7)) , Integer.parseInt(temp1.substring(8,10)));  
		//int dayOfWeekint = cal.get(cal.DAY_OF_WEEK);
		int year = new Integer(temp1.substring(0,4)).intValue();
		int month = new Integer(temp1.substring(5,7)).intValue();
		int day = new Integer(temp1.substring(8,10)).intValue();

		  if(month==1) {
			  month = 13;
			  year = year-1;
		  }
          if(month==2) {
			  month = 14;
			  year = year-1;
		  }

		int dayOfWeekint = (day+2*month+3*(month+1)/5+year+year/4-year/100+year/400)%7;
		System.out.println(dayOfWeekint);
		switch (dayOfWeekint)
		{
			case 0:dayofweek = "星期一";dayofweeke = "Monday"; break;
			case 1:dayofweek = "星期二";dayofweeke = "Tuesday"; break;
			case 2:dayofweek = "星期三";dayofweeke = "Wednesday"; break;
			case 3:dayofweek = "星期四";dayofweeke = "Thursday"; break;
			case 4:dayofweek = "星期五";dayofweeke = "Friday"; break;
			case 5:dayofweek = "星期六";dayofweeke = "Saturday"; break;
			case 6:dayofweek = "星期日";dayofweeke = "Sunday"; break;
		}
	}

 
%>
<html>
<head>
<title><%=pageFunc%></title>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 

<script language="javascript">
function goback()
{
	window.close();
}
</script>
<style>body {background:url("<%=path %>/previewimage/<%=request.getAttribute("fileName") %>") repeat fixed!important;}</style> 

</head>
<%if(null == meetingId||"null".equals(meetingId)){
 %>
<body   leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
 
<table width="100%" height="200"  border="0" >
  <tr> 
    <td height="200">
<div align="center">
        <p>&nbsp;</p>
      </div></td>
  </tr>
  </table>
 <table width="100%" height="90" border="0">
 <tr> 
 <%
	if(!"".equals(request.getAttribute("filePath")))
	{ 
%>
    <td height="90"><div <%=styleLogo%>>

	<img name="" src="<%=path %>/uploadfile/<%=request.getAttribute("filePath")%>" height="90" alt="">

	</div></td>
	<%
	}
%>
  </tr>
  </table>
 <table width="100%" height="140" border="0">
  <tr height="45"> 
    <td width="100%"><div   <%=styleText%>><font color="#FFFFFF" size="6" face="Myriad Pro Light"><strong><%=request.getAttribute("hytzLine1")%></font></div></td>
  </tr>
  <tr> 
  <tr height="45"> 
  <td width="100%"><div <%=styleText%>><font color="#FFFFFF" size="6" face="Myriad Pro Light"><strong><%=request.getAttribute("hytzLine2")%></font></div></td>
  </tr>
  <tr> 
  <tr height="45"> 
   <td width="100%"><div <%=styleText%>><font color="#FFFFFF" size="6" face="Myriad Pro Light"><strong><%=request.getAttribute("hytzLine3")%></font></div></td>
  </tr>
  <tr> 
   <tr height="45"> 
    <td width="100%"><div <%=styleText%>><font color="#FFFFFF" size="6" face="Myriad Pro Light"><strong><%=request.getAttribute("hytzLine4")%></font></div></td>
  </tr>
  <tr> 
    <td><div align="center"></div></td>
  </tr>
  <tr> 
    <td nowrap><div <%=styleText%>><font face="Arial Narrow" color="#000000"  size="4"><strong><%=listtime%> &nbsp; 
        &nbsp; &nbsp; <font face="Arial Narrow" size="4"><strong><%=listtimee%></font></font></div></td>
  </tr>
  <tr> 
    <td ><div <%=styleText%> ><font face="Arial Narrow" color="#000000" size="4"><strong><%=listdate%> &nbsp;<%=dayofweek%></div></td>
  </tr>
  <tr> 
    <td><div <%=styleText%>><font face="Arial Narrow" color="#000000" size="4"><strong><%=dayofweeke%>&nbsp;<%=listdatee%></font></div></td>
  </tr>
  </table>
   
 <!-- <table width="100%" height="2%" style="margin-bottom:2px;" valign="bottom" border="0">
   <tr > 
    <td><div align="right"  > &nbsp;</div></td>
  </tr>
  <tr > 
    <td><div align="right"  ><a href="javascript:window.close()">关闭</a>&nbsp;&nbsp;&nbsp;
	<a href="javascript:window.print()">打印</a></div></td>
  </tr>
</table>-->
</td>
</tr>
</table>
</body>
<%}else{
DBOperator dbo = new DBOperator(session.getServletContext());
List data = dbo.select("select * from cms_meeting where id=?", new Object[]{meetingId});
 
Map m = (Map)data.get(0);
String time = m.get("TIME_DISPLAY_CONFIG")+"";
String[] times = null;
if(time!=null && !"null".equals(time)){
	times = time.split("@");
}
String week = m.get("WEEK_DISPLAY_CONFIG")+"";
String[] weeks = null;
if(week!=null && !"null".equals(week)){
	weeks = week.split("@");
}
String date = m.get("DATE_DISPLAY_CONFIG")+"";
String[] dates = null;
if(date!=null && !"null".equals(date)){
	dates = date.split("@");
}
String line1 = m.get("LINE1_DISPLAY_CONFIG")+"";
String[] line1s = null;
if(line1!=null && !"null".equals(line1)){
	line1s = line1.split("@");
} 
String line2 = m.get("LINE2_DISPLAY_CONFIG")+"";
String[] line2s = null;
if(line2!=null && !"null".equals(line2)){
	line2s = line2.split("@");
}
String line3 = m.get("LINE3_DISPLAY_CONFIG")+"";

String[] line3s = null;
if(line3!=null && !"null".equals(line3)){
	line3s = line3.split("@");
	 
}
String line4 = m.get("LINE4_DISPLAY_CONFIG")+"";
String[] line4s = null;
if(line4!=null && !"null".equals(line4)){
	line4s = line4.split("@");
}
 %>
<body   leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="20" border="0" >
  <tr> 
    <td height="20 ">
<div align="center">
        <p>&nbsp;</p>
      </div></td>
  </tr>
  </table>
 <table width="100%" height="90"   border="0">
 <tr> 
 <%
	if(!"".equals(request.getAttribute("filePath")))
	{ 
%>
    <td height="90"><div <%=styleLogo%>>

	<img name="" src="<%=path %>/uploadfile/<%=request.getAttribute("filePath")%>" height="90" alt="">

	</div></td>
	<%
	}
%>
  </tr>
  </table>
 <table width="100%"   border="0"  >
  <tr  > 
    <td width="100%"><div  <%=styleText%>><font <%if(line1s !=null&&!"null".equals(line1s[0])){out.print("color="+line1s[0]+" ");}else{ %>color="#FFFFFF" <%} %> <%if(null!=line1s&&!"null".equals(line1s[2])){out.print("size="+line1s[2]+" ");}else{ %>size="6"<%} %> face="Myriad Pro Light"><strong><%=request.getAttribute("hytzLine1")%></font></div></td>
  </tr>
  <tr> 
  <tr height="45"> 
  <td width="100%"><div <%=styleText%>><font <%if(line2s!=null&&!"null".equals(line2s[0])){out.print("color="+line2s[0]+" ");}else{ %>color="#FFFFFF" <%} %> <%if(null!=line2s&&!"null".equals(line2s[2])){out.print("size="+line2s[2]+" ");}else{ %>size="6"<%} %> face="Myriad Pro Light"><strong><%=request.getAttribute("hytzLine2")%></font></div></td>
  </tr>
  <tr> 
  <tr height="45"> 
   <td width="100%"><div <%=styleText%>><font <%if(line3s!=null&&!"null".equals(line3s[0])){out.print("color="+line3s[0]+" ");}else{ %>color="#FFFFFF" <%} %> <%if(null!=line3s&&!"null".equals(line3s[2])){out.print("size="+line3s[2]+" ");}else{ %>size="6"<%} %> face="Myriad Pro Light"><strong><%=request.getAttribute("hytzLine3")%></font></div></td>
  </tr>
  <tr> 
   <tr height="45"> 
    <td width="100%"><div <%=styleText%>><font <%if(line4s!=null&&!"null".equals(line4s[0])){out.print("color="+line4s[0]+" ");}else{ %>color="#FFFFFF" <%} %> <%if(null!=line4s&&!"null".equals(line4s[2])){out.print("size="+line4s[2]+" ");}else{ %>size="6"<%} %> face="Myriad Pro Light"><strong><%=request.getAttribute("hytzLine4")%></font></div></td>
  </tr>
  <tr> 
    <td><div align="center"></div></td>
  </tr>
  <tr> 
    <td><div <%=styleText%>><font face="Arial Narrow" <%if(null!= times&&!"null".equals(times[0])){out.print("color="+times[0]+" ");}else{ %>color="#FFFFFF" <%} %> <%if(null!=times&&!"null".equals(times[2])){out.print("size="+times[2]+" ");}else{ %>size="4"<%} %>><strong><%=listtime%> &nbsp; 
        &nbsp; &nbsp; <%=listtimee%></strong></font></div></td>
  </tr>
  <tr> 
    <td><div <%=styleText%>><font face="Arial Narrow" <%if(null!=weeks&&!"null".equals(weeks[0])){out.print("color="+weeks[0]+" ");}else{ %>color="#FFFFFF" <%} %> <%if(null!=weeks&&!"null".equals(weeks[2])){out.print("size="+weeks[2]+" ");}else{ %>size="4"<%} %>><strong><%=listdate%> &nbsp;</strong></font><font face="Arial Narrow" <%if(null!=weeks&&!"null".equals(weeks[0])){out.print("color="+weeks[0]+" ");}else{ %>color="#FFFFFF" <%} %> <%if(null!=weeks&&!"null".equals(weeks[2])){out.print("size="+weeks[2]+" ");}else{ %>size="4"<%} %>><strong><%=dayofweek%></strong></font></div></td>
  </tr>
  <tr> 
    <td><div <%=styleText%>><font face="Arial Narrow" <%if(null!=dates&&!"null".equals(dates[0])){out.print("color="+dates[0]+" ");}else{ %>color="#FFFFFF" <%} %> <%if(null!=dates&&!"null".equals(dates[2])){out.print("size="+dates[2]+" ");}else{ %>size="4"<%} %>><strong><%=dayofweeke%>&nbsp;</strong></font><font face="Arial Narrow" <%if(null!=dates&&!"null".equals(dates[0])){out.print("color="+dates[0]+" ");}else{ %>color="#FFFFFF" <%} %> <%if(null!=dates&&!"null".equals(dates[2])){out.print("size="+dates[2]+" ");}else{ %>size="4"<%} %>><strong><%=listdatee%></strong></font></div></td>
  </tr>
  </table>
  <!-- <table width="100%" height="2%" style="margin-bottom:2px;" valign="bottom" border="0">
   <tr > 
    <td><div align="right"  > &nbsp;</div></td>
  </tr>
  <tr > 
    <td><div align="right"  ><a href="javascript:window.close()">关闭</a>&nbsp;&nbsp;&nbsp;
	<a href="javascript:window.print()">打印</a></div></td>
  </tr>
</table>-->
</body>

<%} %>
</html>
